package lol.clann.minecraft.springboot.api.model.reflect;

import lombok.Getter;

import java.lang.reflect.Method;

/**
 *
 * @author pyz
 * @date 2019/6/7 12:22 AM
 */
public class SetterMethod extends MethodInvoker {
    @Getter
    protected Class type;

    public SetterMethod(Method method) {
        super(method);
        if (method.getParameterCount() != 1) {
            throw new IllegalArgumentException("setter method can only have 1 parameter:" + String.valueOf(method));
        }
        type = method.getParameterTypes()[0];
    }

    public void set(Object o, Object v) {
        invoke(o, v);
    }
}
